package com.DHT;

public class FNVHash {
    private static final long FNV_OFFSET_BASIS_64 = 0xcbf29ce484222325L;
    private static final long FNV_PRIME_64 = 0x100000001b3L;

    public static long fnv1a64(String key) {
        long hash = FNV_OFFSET_BASIS_64;
        final int len = key.length();
        for (int i = 0; i < len; i++) {
            hash ^= key.charAt(i);
            hash *= FNV_PRIME_64;
        }
        return hash;
    }

    public static void main(String[] args) {

    }
}
